import React, {useEffect, useState} from 'react';
import {
  ScrollView,
  View,
  Text,
  TouchableOpacity,
  ActivityIndicator,
  FlatList,
  Image,
  TextInput,
  ImageBackground,
} from 'react-native';
import {useNavigation} from '@react-navigation/native';
import AreaView from '../../components/Layout/AreaView';
import BaseUrl from '../../config/BaseUrl';
import {couponcustList} from '../../service/home';

import styles from './style';

const MsgNotice = (props) => {
  const navigation = useNavigation();
  const {
    route: {
      params: {custId},
    },
  } = props;
  const [couponData, setCouponData] = useState([]);
  useEffect(() => {
    couponcustList({
      custId,
      couponCustStatus: 1,
    }).then((res) => {
      console.log(res);
      setCouponData(res.rows);
    });
  }, []);
  return (
    <AreaView>
      <ScrollView style={styles.container}>
        {(couponData || []).map((item) => (
          <TouchableOpacity  activeOpacity={1} key={item.couponCustId} style={styles.list}>
            <Image
              style={styles.coupon_bg}
              source={{uri: BaseUrl.imgurl + item.couponImg}}
            />
            {/* <ImageBackground
              source={require('../../assets/images/coupon.png')}
              style={styles.coupon_bg}>
              <View style={styles.coupon_info}>
                <View style={styles.coupon_unit}>
                  <Text style={styles.unit_text}>¥</Text>
                </View>
                <View style={styles.money}>
                  <Text style={styles.money_text}>1000</Text>
                </View>
                <View style={styles.coupon_type}>
                  <Text style={styles.type_text}>优</Text>
                  <Text style={styles.type_text}>惠</Text>
                  <Text style={styles.type_text}>券</Text>
                </View>
              </View>
              <View style={styles.footer}>
                <Text style={styles.foot_text}>满1000减100元</Text>
              </View>
            </ImageBackground> */}
            <View style={styles.info}>
              <Text style={styles.info_text}>{item.couponName}</Text>
              <View style={styles.box}>
                <Text style={styles.time}>有效期至{item.validFinishTime}</Text>
                {/* <TouchableOpacity  activeOpacity={1} style={styles.btn}>
                  <Text style={styles.btn_text}>去使用</Text>
                </TouchableOpacity> */}
              </View>
            </View>
          </TouchableOpacity>
        ))}
      </ScrollView>
    </AreaView>
  );
};

export default MsgNotice;
